package cn.yunhe.biz;

import cn.yunhe.exception.OutOfStockException;
import cn.yunhe.model.Customer;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;


public class RefrigeratorImpl implements Refrigerator{
    int maxCount=3;
    @Override
    public void saleRefrigerator(Customer customer,int count) throws OutOfStockException {
        if (count>maxCount){
            throw  new OutOfStockException(customer.getName()+" 实际需要购买 "+count+" 台,超出限购总数量: "+maxCount+" 台,无法购买.");
        }
        System.out.println(customer.getName()+"成功购买特价电冰箱："+count+"台");
    }


}
